﻿using AdminBase.Model;
using AdminBase.Model.Entitys;

namespace AdminBase.Interface
{
    /// <summary>
    /// 用户业务接口
    /// </summary>
    public interface IUsersService
    {
        /// <summary>
        /// 更新登陆时间
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        Task UpdateLoginTimeAsync(long id);

        /// <summary>
        /// 根据id或账号获取单个用户
        /// </summary>
        /// <param name="id"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        UsersDto GetUser(long? id = null, string? userName = null);

        /// <summary>
        /// 判断用户是否已存在
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        bool Exists(string userName);

        /// <summary>
        /// 获取用户相关信息：角色、权限、部门、头像等
        /// </summary>
        /// <param name="id">id</param>
        /// <returns></returns>
        UsersDto GetUserInfo(long id);

        /// <summary>
        /// 获取用户列表
        /// </summary>
        /// <param name="queryParam">查询参数</param>
        /// <param name="pageBase">分页查询</param>
        /// <returns></returns>
        PageInfo GetUsers(UsersQueryParam queryParam, PageBase pageBase);

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        bool Add(UsersDto user);

        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="input"></param>
        /// <param name="info">修改个人中心信息</param>
        /// <returns></returns>
        bool Edit(UsersDto input, bool info = false);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        bool Del(long id);

        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        bool BatchDel(List<long> ids);


        /// <summary>
        /// 根据userid获取角色
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        List<Roles> GetRolesByUserId(long uid);

        /// <summary>
        /// 修改激活状态
        /// </summary>
        /// <param name="users"></param>
        /// <returns></returns>
        bool UpdateActive(Users users);

        /// <summary>
        /// 设置密码
        /// </summary>
        /// <param name="passwordDto"></param>
        /// <returns></returns>
        bool SetPassword(PasswordDto passwordDto);

        /// <summary>
        /// 设置头像
        /// </summary>
        /// <param name="userName">账号</param>
        /// <param name="fileID">文件ID</param>
        /// <returns></returns>
        bool SetAvatar(string userName, string fileID);
    }
}
